Skip to content

Split string command and entrypoint after interpolation - #1520

Open
Sanjays2402 wants to merge 4 commits into
containers:mainfrom
Sanjays2402:fix/config-command-array
Open

Split string command and entrypoint after interpolation#1520
Sanjays2402 wants to merge 4 commits into
containers:mainfrom
Sanjays2402:fix/config-command-array

Conversation

@Sanjays2402

Copy link
Copy Markdown

Closes #1514

Contributor Checklist:

Please make sure to read development guidelines in CONTRIBUTING.md. Pull requests that do not
follow the guidelines WILL TAKE LONGER TO REVIEW as the first review comment will be to follow
these guidelines.

If this PR adds a new feature that improves compatibility with docker-compose, please add a link
to the exact part of compose spec that the PR touches.

For any user-visible change please add a release note to newsfragments directory, e.g.
newsfragments/my_feature.feature. See newsfragments/README.txt for more details.

All changes require additional unit tests.


Bug fix, not a new feature, so no compose spec link applies.

#1504 removed the shlex.split() of string command/entrypoint from normalize_service (it ran before interpolation and broke ${VAR:?error message}), but nothing re-applied the split afterwards, so podman-compose config regressed to emitting command: sleep infinity instead of the array docker-compose produces. normalize_service_final runs after rec_subs, so the split now happens there.

Unit tests added in tests/unit/test_normalize_final_build.py (fail without the fix, pass with it). I did not add a newsfragment - happy to add one if you would like it for this regression fix.

PR containers#1504 removed the shlex.split() of string `command`/`entrypoint` from
normalize_service because it ran before variable interpolation and broke
expressions such as ${VAR:?error message}. Nothing re-applied the split
afterwards, so `podman-compose config` regressed to emitting
`command: sleep infinity` as a plain string instead of the array
docker-compose produces.

normalize_service_final runs after rec_subs, so the split is applied
there. container_to_args already handled both forms, so only the config
output was affected.

Signed-off-by: Sanjay Santhanam <51058514+Sanjays2402@users.noreply.github.com>
({"image": "busybox", "entrypoint": "/bin/sh -c"}, None, ["/bin/sh", "-c"]),
]

@parameterized.expand(cases_command_normalization)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just include the list inline as expand() parameter

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 1ea4d1d — the list is inline in expand() now. 44 tests in that file pass, ruff format/check clean.

@p12tic p12tic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks. Just one nit.

@p12tic

p12tic commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

@Sanjays2402 All tests are failing for some reason

Signed-off-by: Sanjay Santhanam <51058514+Sanjays2402@users.noreply.github.com>
@Sanjays2402

Copy link
Copy Markdown
Author

The failures were four stale config-output expectations, not failures in the command splitting itself. normalize_service_final() now deliberately emits command as an argument list, so the config output is:

command:
- echo
- from-dotenv

I updated all four compose_file_from_env expectations, merged current main, and added the required bugfix news fragment in d6141ff. The focused normalization suite is green (44 tests). I could not run the integration suite locally because Podman is not installed; CI will exercise those tests on this head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression of config command arguments to string (should be array)

2 participants